package com.itheima.day08;

import java.util.Scanner;

public class Test1 {
    /*
    已知用户名和密码，请用程序实现模拟用户登录。总共给三次机会，是否登录成功，给出相应的提示。
     */
    public static void main(String[] args) {
        String admin = "张三";
        String password = "123456";
    Scanner sc = new Scanner(System.in);
        for (int i = 1; i <= 3; i++) {
            System.out.println("请输入用户名:");
            String usename = sc.nextLine();
            System.out.println("请输入密码:");
            String usemima = sc.nextLine();
            if (usename.equals(admin) && usemima.equals(password)) {
                System.out.println("登陆成功");
                break;
            } else if (i == 3) {
                    System.out.println("输入错误,您今日机会已达上线,请明日再试");
                }else{
                    System.out.println("输入错误,您还剩" + (3-i) +"次机会");
                }
        }
    }
}
